<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"  href="/styles/general.css"/>
<link rel="stylesheet" type="text/css" href="/styles/main.css"/>
<link rel="stylesheet" type="text/css" href="/styles/validator.css"/>
<link rel="stylesheet" href="/themes/custom-theme/jquery.ui.all.css">
<script src="/js/common.js" type="text/javascript"></script>
<script src="/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="/js/ui/jquery.ui.core.js" type="text/javascript"></script>
<script src="/js/ui/jquery.ui.widget.js" type="text/javascript"></script>
<script src="/js/ui/jquery.ui.tabs.js" type="text/javascript"></script>
<script src="/scripts/kedit/kindeditor-min.js" type="text/javascript"></script>
<script src="/scripts/kedit/lang/zh_CN.js" type="text/javascript"></script>
<script src="/js/formValidator.js" type="text/javascript"></script>
<script src="/js/formValidatorRegex.js" type="text/javascript"></script>
<script type="text/javascript">
function showsalt(){
		$.ajax({			
	        url:"/compoundsalt/indexajax/compoundid/$id",
	        cache: false,
	        success: function(html){
				$("#divsalt").html(html);
				$(".openwinsmall").click(
					function(){
						openwinx($(this).attr("href"),'sss','600','400');
						return false;
				});
				$(".ajaxsubmit").click(
        			function(){
        			$(this).doAjax();
        			return false;
        		});
	        }
	    });
}
function showsolvent(){
	$.ajax({			
	        url: "/compoundsolvent/indexajax/compoundid/$id",
	        cache: false,
	        success: function(html){
				$("#divsolvent").html(html);
				$(".openwinsmall").click(
					function(){
						openwinx($(this).attr("href"),'sss','600','400');
						return false;
				});
				$(".ajaxsubmit").click(
        			function(){
        			$(this).doAjax();
        			return false;
        	});
	        }
	    });
}
jQuery.fn.extend({
	  doAjax: function() {
	  	obj = $(this).parent().parent();
		if($(this).attr("href").indexOf("delete")>0)
	  	{
			if(!confirm("确定删除吗?"))return false;
		}
		$.ajax({			
	        url: $(this).attr("href"),
	        cache: false,
	        success: function(html){
				//PageClick(page);
				//$(this).parent().parent().hide();
				obj.hide();
	        }
	    });
	  }
	});
$(document).ready(function(){
	showsalt();
	showsolvent();
	$( "#tabs" ).tabs();
	$.formValidator.initConfig({formid:"myform",onerror:function(msg){alert(msg)}});
	//$("#casno").formValidator({onshow:"请输入CAS No.",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	//$("#compoundno").formValidator({onshow:"请输入内部编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	//$("#compoundname").formValidator({onshow:"请输入中文名",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	//$("#compoundnameen").formValidator({onshow:"请输入英文名",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#projectid").formValidator({onshow:"请输入项目编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,max:1000,type:"value",onerror:"长度不正确,请确认"}).defaultPassed();;
	$("#noteid").formValidator({onshow:"请输试验记录本编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#notepage").formValidator({onshow:"请输入页码",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	var url = "/compound/checkno/id/$id/";
	$("#compoundno").formValidator({onshow:"请输入内部编号",onfocus:"内部编号至少4个字符,最多30个字符",oncorrect:"内部编号可用"}).inputValidator({min:4,max:30,onerror:"你输入的内部编号不可用,请确认"}).ajaxValidator({
    type : "get",
	url : url,
	datatype : "json",
	success : function(data){
        if( data == "1" )
		{
            return true;            
		}
        else
		{
            return false;
		}		
	},
	buttons: $("#compoundno"),
	error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
	onerror : "内部编号重复，请重新输入",
	onwait : "正在校验内部编号，请稍候..."
	}).defaultPassed();
var editor = KindEditor.create('textarea[name="synthesisdoc"]');
var editor1 = KindEditor.create('textarea[name="biodoc"]');
/*
$("#btnspectrum").bind('click', function(event) {
	$("#wrapspectrum").append($("#linespectrum").html());
});
$("#btnreference").bind('click', function(event) {
	$("#wrapreference").append($("#linereference").html());
});
$("#btncompoundsave").bind('click', function(event) {
	$("#wrapcompoundsave").append($("#linecompoundsave").html());
});
$("#btngain").bind('click', function(event) {
	$("#wrapgain").append($("#linegain").html());
});*/
$("#submit").bind('click', function(event) {
	$("#url").val($("li[class='ui-state-default ui-corner-top ui-tabs-selected ui-state-active']>a").attr("href"));
	//if(!confirm("确认保存吗?")){
	//	return false;
	//}
});
$("#tabs>ul>li>a").bind('click', function(event) {
	//$("#url").val($(this).attr("href"));
	if($(this).attr("href")=="#tabs-1"||$(this).attr("href")=="#tabs-2"){
		setv('mol',$("#mol").val());
		setv('synthesisroute',$("#synthesisroute").val());	
	}
});
$(document).keydown(function(event){ 
	if(event.which=="13"){
		$("#submit").trigger('click');
	}
});
$(".ajaxsubmit").click(
        			function(){
        			$(this).doAjax();
        			return false;
        			});
if($exist=="1"){
		alert("该化合物已经存在，请直接添加批次");
	}
$(".openwin").click(
	function(){
		openwinx($(this).attr("href"),'sss','800','1000');
		return false;
	});
});

</script>
<title></title>
</head>
<body>
<h1>
<span class="action-span"><a class="openwin" href="/compound/show/id/$id">预览</a>
<a href="/compound/add">继续添加化合物</a></span>
<span class="action-span1">修改化合物 </span>
<div style="clear:both"></div>
</h1>
<div class="main-div">
  <form action="/compound/modify/id/$id" method="post" name="myform" id="myform" enctype="multipart/form-data">
  <input name='id' id='id' type="hidden" value="$id" /> 
  <div id="tabs">
	<ul>
		<li><a href="#tabs-1">基本信息</a></li>
		<li><a href="#tabs-2">制备方法</a></li>
		<li><a href="#tabs-5">样品批次</a></li>
		<li><a href="#tabs-3">分析谱图</a></li>
		<li><a href="#tabs-6">生物活性</a></li>
		<li><a href="#tabs-7">参考文献</a></li>
		<li><a href="#tabs-4">相关成果</a></li>
	</ul>
	<div id="tabs-1">
  <table width="100%">
  	<tr>
        <td  rowspan="17" style="width:370px;" align="right" valign="top">
			{form chem * mol mol $info['mol']}
			<table>
				<tr>
			        <td class="label">分子式：</td>
			        <td>
			        	$info['formula']
			        </td>
			      </tr>
			      <tr>
			        <td class="label">分子量：</td>
			        <td>
			        	$info['molecularweight']
			        </td>
			       
			      </tr>
				 <tr>
			        <td class="label">盐：</td>
			        <td>
			        	<a href="/compoundsalt/add/compoundid/$info['id']" class="openwinsmall">+新增</a>
			        	<div id="divsalt"> </div>
			        </td>
			      </tr>
			      <tr>
			        <td class="label subtable">溶剂：</td>
			        <td class="subtable">
			        	<a href="/compoundsolvent/add/compoundid/$info['id']" class="openwinsmall">+新增</a>
			        	<div id="divsolvent"> </div>
			        </td>
			     
			     </tr>
			</table>
        </td>
        <td class="label">项目编号：</td>
        <td>
			{form select * projectid projectid $info['projectid'] * * $projectlist}
        </td>
        <td><div id='projectidTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">CAS No.：</td>
        <td>
			{form text * casno casno $info['casno']}
        </td>
        <td><div id='casnoTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">内部编号：</td>
        <td>
			{form text * compoundno compoundno $info['compoundno']}
        </td>
        <td><div id='compoundnoTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">中文名：</td>
        <td>
			{form text * compoundname compoundname $info['compoundname']}
        </td>
        <td><div id='compoundnameTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">英文名：</td>
        <td>
			{form text * compoundnameen compoundnameen $info['compoundnameen']}
        </td>
        <td ><div id='compoundnameenTip' style="width:250px"></div></td>
     </tr>
  	 <tr>
        <td class="label subtable">别名：</td>
        <td class="subtable">
			{form text * compoundnameother compoundnameother $info['compoundnameother']}
        </td>
        <td class="subtable"><div id='compoundnameotherTip' style="width:250px"></div></td>
      </tr>
      <!-- 
     <tr>
        <td class="label">分子式：</td>
        <td>
			{form text * formula formula $info['formula']}
        </td>
        <td><div id='formulaTip' style="width:250px"></div></td>
     </tr>
    
     
     <tr>
        <td class="label">分子量：</td>
        <td>
			{form text * molecularweight molecularweight $info['molecularweight']}
        </td>
        <td><div id='molecularweightTip' style="width:250px"></div></td>
     </tr>
      -->
     
     <tr>
        <td class="label">是否终产物：</td>
        <td>
			{form radio * product product $info['product']}
        </td>
        <td><div id='productTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">是否专利保护：</td>
        <td>
			{form radio * patent patent $info['patent'] * * $patentlist}
        </td>
        <td><div id='patentTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">试验记录本编号：</td>
        <td>
			{form text * noteid noteid $info['noteid']}
        </td>
        <td><div id='noteidTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label subtable">页码：</td>
        <td class="subtable">
			{form text * notepage notepage $info['notepage']}
        </td>
        <td  class="subtable"><div id='notepageTip' style="width:250px"></div></td>
      </tr>
     <tr>
        <td class="label">外观性状：</td>
        <td>
			{form text * appearance appearance $info['appearance']}
        </td>
        <td><div id='appearanceTip' style="width:250px"></div></td>
     </tr>
     <tr>
     	
        <td class="label">溶解性：</td>
        <td>
			{form text * solubility solubility $info['solubility']}
        </td>
        <td><div id='solubilityTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">熔点：</td>
        <td>
			{form text * meltingpoint meltingpoint $info['meltingpoint']}
        </td>
        <td><div id='meltingpointTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">沸点：</td>
        <td>
			{form text * boilingpoint boilingpoint $info['boilingpoint']}
        </td>
        <td><div id='boilingpointTip' style="width:250px"></div></td>
     </tr>
     
     <tr>
        <td class="label">稳定性：</td>
        <td>
			{form text * stability stability $info['stability']}
        </td>
        <td><div id='stabilityTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">旋光性：</td>
        <td>
			{form text * optical optical $info['optical']}
        </td>
        <td><div id='opticalTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">手性：</td>
        <td>
			{form text * chirality chirality $info['chirality']}
        </td>
        <td><div id='chiralityTip' style="width:250px"></div></td>
      </tr>
      <!--
      <tr>
        <td class="label">LogP：</td>
        <td>
			{form text * logp logp $info['logp']}
        </td>
        <td><div id='logpTip' style="width:250px"></div></td>
      </tr>
     -->
  </table>
  </div>
  <div id="tabs-2">
  	<table width="100%">
  	     <tr>
        <td class="label">合成路线：</td>
        <td>
			{form chem * synthesisroute synthesisroute $info['synthesisroute'] * 650}
        </td>
        <td><div id='synthesisrouteTip' style="width:250px"></div></td>
     </tr>
     <tr>
        <td class="label">试验记录：</td>
        <td>
			{form keditor * synthesisdoc synthesisdoc $info['synthesisdoc']}
        </td>
        <td><div id='synthesisdocTip' style="width:250px"></div></td>
     </tr>
     <tr>
		<td class="label">试验文档：</td>
		<td>
		{form file * synthesisfile synthesisfile} 
		<a target="_blank" href="/upload/file/$info['synthesisfileurl']">$info['synthesisfilename']</a>
		</td>
		<td> </td>
	</tr>
  </table>
  </div>
  <div id="tabs-3" style="padding:0 0 0 2px">
  	<iframe width="100%" scrolling-x="no" scrolling-y="auto" height="400px" frameborder ="0" src="/compoundspectrum/index/compoundid/$id" ></iframe>
  </div>
  <div id="tabs-4" style="padding:0 0 0 2px">
  	<iframe width="100%" scrolling-x="no" scrolling-y="auto" height="400px" frameborder ="0" src="/compoundgain/index/compoundid/$id" ></iframe>
  </div>
  <div id="tabs-5" style="padding:0 0 0 2px">
  	<iframe width="100%" scrolling-x="no" scrolling-y="auto"  height="400px" frameborder ="0" src="/compoundsave/index/compoundid/$id" onload="this.contentWindow.document.scrollHeight"></iframe>
  	</div>
  	<div id="tabs-6">
		<table width="100%">
	      <tr>
	        <td class="label">生物活性：</td>
	        <td>
				{form keditor * biodoc biodoc}
	        </td>
	        <td><div id='synthesisdocTip' style="width:250px"></div></td>
	      </tr>
		</table>
	</div>
	<div id="tabs-7" style="padding:0 0 0 2px">
  		<iframe width="100%" scrolling-x="no" scrolling-y="auto"  height="400px" frameborder ="0" src="/compoundreference/index/compoundid/$id" onload="this.contentWindow.document.scrollHeight"></iframe>
  	</div>
  </div>
  
   <div class="button-div">
   		{form hidden * url url}
   		{form select * status status $info["status"] * 10 $statusList}
   		 &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="submit" id="submit" name="submit" value="&nbsp;确&nbsp;定&nbsp;" />
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="reset" value="&nbsp;重&nbsp;置&nbsp;" />
   </div>
      
  </form>
</div>
{template 'footer.html'}
</body>
</html>